package cn.cocho.android.mc.comp.dialog;

import android.app.AlertDialog;
import android.content.Context;
import android.widget.ImageView;
import android.widget.TextView;

import cn.cocho.android.mc.R;

public class McProgressBar extends AlertDialog {

	public McProgressBar(Context context) {
		super(context);
		init();
	}
	
	private void init(){
		try {
			show();
			setContentView(R.layout.mc_progress_bar);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	
	public void setMessage(CharSequence message) {
		TextView msgView = (TextView) findViewById(R.id.mc_progress_bar_message);
		msgView.setText(message);
	}
	
	public void setMessage(CharSequence message, int msgViewId) {
		TextView msgView = (TextView) findViewById(msgViewId);
		msgView.setText(message);
	}
	
	public void setCancelBtnListener(android.view.View.OnClickListener listener) {
		ImageView cancelBtn = (ImageView) findViewById(R.id.mc_progress_bar_cancel_btn);
		cancelBtn.setOnClickListener(listener);
	}

	public void setCancelBtnListener(int cancelBtnId, android.view.View.OnClickListener listener) {
		ImageView cancelBtn = (ImageView) findViewById(cancelBtnId);
		cancelBtn.setOnClickListener(listener);
	}

}
